<?php
include("./Core/Common.php");
if(count($_GET))$queryArr=$_GET;else$queryArr=$_POST;
//@header('Content-Type: application/json; charset=UTF-8');
switch(daddslashes($queryArr['act'])){
case 'Get_DATA'://分支接口授权
	$allowurl=file_get_contents('api/instant_vpn_list.txt');
	$real_ip=real_ip();
	if(strpos($allowurl,$real_ip.'----'))
	{
		$result=array('code'=>1,'msg'=>'已授权','url'=>$zeroapi,'ip'=>'[<font color=green>正常</font>]');
	}else{
		$result=array('code'=>-1,'msg'=>'未授权','ip'=>real_ip());
	}
break;
case 'Get_MAIL'://邮件发送API
	$allowurl=file_get_contents('api/instant_vpn_list.txt');
	$real_ip=real_ip();
	if(strpos($allowurl,$real_ip.'----'))
	{
		$email=daddslashes($queryArr['email']);//邮箱地址
		$name=daddslashes($queryArr['name']);//邮件标题
		$msg=daddslashes($queryArr['msg']);//邮件内容
		$send_mail=send_mail($email, $name, $msg);
		if($send_mail){
			$result=array('code'=>1,'msg'=>'发送成功');
		}else{
			$result=array('code'=>-2,'msg'=>'发送失败');
		}
	}else{
		$result=array('code'=>-1,'msg'=>'未授权','ip'=>real_ip());
	}
break;
case 'Instant_Update'://即时到帐软件更新内容
	$wx=array('v'=>'1.0','vmsg'=>'1.0版本更新内容','url'=>'更新下载地址','cjurl'=>'https://share.weiyun.com/5sA0nU8');
	$qq=array('v'=>'1.0','vmsg'=>'1.0版本更新内容','url'=>'更新下载地址');
	$ali=array('v'=>'1.0','vmsg'=>'1.0版本更新内容','url'=>'更新下载地址');
	$result=array('code'=>1,'wx'=>$wx,'qq'=>$qq,'ali'=>$ali);
break;
case 'Instant_Load'://微信店员监控软件下载
	$name=daddslashes(urlencode($queryArr['name']));//软件名次
	$url=daddslashes(urlencode($queryArr['url']));//软件对接地址http://pay.pldgx.cn/
	$authcode=daddslashes(urlencode($queryArr['authcode']));//授权码
	$siteurl = ($_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].'/';
	header("Location:{$siteurl}INTLPAY_LOAD/INTLPAY_LOAD.php?name={$name}&url={$url}&authcode={$authcode}");//发起登录
break;
case 'PC_Load'://PC软件下载
	$name=daddslashes(urlencode($queryArr['name']));//软件名次
	$url=daddslashes(urlencode($queryArr['url']));//软件对接地址http://pay.pldgx.cn/
	$authcode=daddslashes(urlencode($queryArr['authcode']));//授权码
	//$data="<script language='javascript'>alert('PC挂机内测中,即将开放下载,请耐心等待...');history.go(-1);</script>";
	//exit("<script language='javascript'>alert('PC挂机内测中,即将开放下载,请耐心等待...');history.go(-1);</script>");
	header("Location:{$siteurl}INTLPAY_LOAD_PC/INTLPAY_LOAD.php?name={$name}&url={$url}&authcode={$authcode}");//发起登录
break;
case 'Instant_Notify'://即时到帐软件通知接口
	$type=daddslashes($queryArr['type']);
	$money=daddslashes($queryArr['money']);
	$data=$Instant_Api->Submit_submit($type,$money,$pid,$key);
break;
case 'Authcode_Ee'://可逆向解[加密接口]
	$string=($queryArr['string']);
	$data=base64_encode(authcode($string, 'ENCODE',SYS_KEY));
	//$data=urlencode($string);
break;
case 'Authcode_De'://可逆向解[解密接口]
	$string=base64_decode($queryArr['string']);
	$data=authcode($string,'DECODE',SYS_KEY);
	//$data=urldecode($queryArr['string']);
break;
default:
	exit('{"code":-9,"msg":"No Act"}');
break;
}
	if($result)
		exit(json_encode($result));
	else
		exit($data);
?>